package com.sinoglobal.sinostore.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.BitmapUtils;
import com.sinoglobal.sinostore.R;
import com.sinoglobal.sinostore.bean.ActiveVo;
import com.sinoglobal.sinostore.system.Constants;
import com.sinoglobal.sinostore.utils.BitmapHelp;
/**
 * 
* @title: TheZoneAdapter.java 
* @package com.chiliring.sinostore.adapter 
* @description: TODO(专区列表Adapter) 
* @author LK
* @date 2015-1-13 下午1:01:35
 */
public class TheZoneAdapter extends BaseAdapter {
	private Context context;
	
	private List<ActiveVo> data;
	
	private BitmapUtils bitmapUtils;
	public TheZoneAdapter(Context context, List<ActiveVo> list){
		this.context = context;
		this.data = list;
		bitmapUtils = BitmapHelp.getBitmapUtils(context);
	}
	@Override
	public int getCount() {
		return data.size();
	}

	@Override
	public ActiveVo getItem(int position) {
		return data.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(null == convertView){
			convertView = LayoutInflater.from(context).inflate(R.layout.shop_item_the_zone_layout, null);
		}
		TextView tvMianTitle = ViewHolder.getViewById(convertView, R.id.tv_mian_title);
		TextView tvSubTtile = ViewHolder.getViewById(convertView, R.id.tv_subtitle);
		ImageView imgTheZone = ViewHolder.getViewById(convertView, R.id.img_the_zone);
		
		final ActiveVo ActiveVo=getItem(position);
        tvMianTitle.setText(ActiveVo.getName());
        tvSubTtile.setText(ActiveVo.getIntroduce());
		bitmapUtils.display(imgTheZone,Constants.PIC_HOST+ActiveVo.getImg());
		
		return convertView;
	}

}
